package com.qf.controller;

import com.qf.pojo.Result;
import com.qf.pojo.SysUsers;
import com.qf.service.UserService;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authc.AuthenticationException;
import org.apache.shiro.authc.UsernamePasswordToken;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.apache.shiro.authz.annotation.RequiresRoles;
import org.apache.shiro.crypto.hash.Md5Hash;
import org.apache.shiro.subject.Subject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @author 汤奇
 * @version V1.0
 * @Project BookPro
 * @Package com.qf.controller
 * @Description: 用户模块
 * @Date 2022/6/14 21:57
 */
@Controller
@RequestMapping("/user")
public class UserController {
    @Autowired
    private UserService userService;

    @RequestMapping("/list")
    @ResponseBody
    //限制只有具有某个角色的权限才可以访问这个方法
//    @RequiresRoles(value = {"管理员"})
    //限制只有具有这个权限的用户才可以访问这个方法
    @RequiresPermissions(value = {"sys:user:select"})
    public List<SysUsers> findUserAll(){
        return userService.findUserAll();
    }
}
